

const char *project_name="mips1";
const char *project_file="mips1.ac";
const char *archc_version="2.0beta1";
const char *archc_options="-abi -dy ";

#include  <systemc.h>
#include  "mips1.H"
#include  "ac_tlm_mem.h"
#include  "ac_tlm_router.h"
#include  "ac_tlm_cache.h"
//#include  "ac_tlm_per.h"
#include  "ac_tlm_dmul.h"
#include  "ac_tlm_dsum.h"

#define AC_DEBUG

using user::ac_tlm_mem;
using user::ac_tlm_router;
using user::ac_tlm_cache;
//using user::ac_tlm_per;
using user::ac_tlm_dmul;
using user::ac_tlm_dsum;



int sc_main(int ac, char *av[])
{

  //!  ISA simulator
  mips1 mips1_proc1("mips1");
  ac_tlm_mem mem("mem");
  ac_tlm_router router("router");
  ac_tlm_cache cacheD("cacheD", "dados");
  ac_tlm_cache cacheI("cacheI", "instrucoes");
//  ac_tlm_per periferico("per");
  ac_tlm_dmul dmul("dmul");
	ac_tlm_dsum dsum("dsum");

#ifdef AC_DEBUG
  ac_trace("mips1_proc1.trace");
#endif 
  //bound processor to caches
  mips1_proc1.DM_port(cacheD.target_export);
  mips1_proc1.EM_port(cacheI.target_export);

  //bound caches to router
  cacheD.DM_port(router.target_exportD);
  cacheI.DM_port(router.target_exportI);

  //bound router to memory
  router.DM_port(mem.target_export);
  //router.DM_port_lock(per.target_export);
  router.DM_port_dmul(dmul.target_export);
	router.DM_port_dsum(dsum.target_export);



  mips1_proc1.init(ac, av);
  cerr << endl;

  sc_start();

  mips1_proc1.PrintStat();
  cerr << endl;

#ifdef AC_STATS
  mips1_proc1.ac_sim_stats.time = sc_simulation_time();
  mips1_proc1.ac_sim_stats.print();
#endif 

#ifdef AC_DEBUG
  ac_close_trace();
#endif 

  return mips1_proc1.ac_exit_status;
}
